{#{% load tag %}#}
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html {width: 100%;height: 100%;margin:0;font-family:"宋体";}
		#allmap{width:100%;height:100%;}
		p{margin-left:0px; font-size:10px;}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=krejNXU0gOAVoRnoGTDczzDrvryBXnmM"></script>
{#	<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>#}
	<title>城际事件展示</title>
</head>
<body>

{#	<p>点击标注点，可查看由纯文本构成的简单型信息窗口</p>#}
{#{% for i in inter_event_list %}#}
{#{% print i.remark %}#}
{#{% endfor %}#}
	<div id="allmap"></div>
</body>

</html>
<script type="text/javascript">
	// 百度地图API功能	
	map = new BMap.Map("allmap");
	map.centerAndZoom(new BMap.Point(110.417854,35.921988), 6);

    map.enableScrollWheelZoom();                        //启用滚轮放大缩小
    map.addControl(new BMap.MapTypeControl());
    map.disable3DBuilding();

{#	var data_info = [[116.417854,39.921988,"地址：北京市东城区王府井大街88号乐天银泰百货八层"],#}
{#					 [116.406605,39.921585,"地址：北京市东城区东华门大街"],#}
{#					 [116.412222,39.912345,"地址：北京市东城区正义路甲5号"]#}
{#					];#}
	var opts = {
				width : 250,     // 信息窗口宽度
				height: 130,     // 信息窗口高度
{#				title : "信息窗口" , // 信息窗口标题#}
				enableMessage:true//设置允许信息窗发送短息
			   };

{#	for(var i=0;i<data_info.length;i++){#}
{#		var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1]));  // 创建标注#}
{#		var content = data_info[i][2];#}
{#		map.addOverlay(marker);               // 将标注添加到地图中#}
{#		addClickHandler(content,marker);#}
{#	}#}

    {% for data_info in inter_event_list %}
        var marker = new BMap.Marker(new BMap.Point({{ data_info.lng }},{{ data_info.lat }}));  // 创建标注
		var content = "{{ data_info.remark |safe}}";

{#       var content = "开始时间: 2016-07-16 00:00:00&lt;/br&gt;结束时间: 2017-04-20 23:59:00&lt;/br&gt;内容: 长邯高速，西向，因改扩建施工，封闭潞城收费站出口。";#}
		map.addOverlay(marker);               // 将标注添加到地图中
		addClickHandler(content,marker);
    {% endfor %}

	function addClickHandler(content,marker){
		marker.addEventListener("click",function(e){
			openInfo(content,e)}
		);
	}
	function openInfo(content,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
</script>
